#ifndef THREAD_RDWR_H
#define THREAD_RDWR_H

#include <QThread>
#include <QTcpServer>
#include <QTcpSocket>
#include <QHash>
#include <QVector>

class Thread_RDWR : public QThread
{
    Q_OBJECT
public:
    explicit Thread_RDWR(QTcpServer* m_tcp, QTcpSocket* ser_t, QHash<QString, QTcpSocket*> ser_hash, QVector<QString> id_, QVector<QString> passwd_, QVector<QString> name_,  QObject *parent = nullptr);

    QTcpServer* m_s;
    QTcpSocket* ser_tcp;
    QHash<QString, QTcpSocket*> hash;
    QVector<QString> id;
    QVector<QString> passwd;
    QVector<QString> name;

signals:
    void over(QTcpSocket *tcp);
    void sendHashData(QString str, QTcpSocket *tcp);
    //定义信号操作 1：代表插入数据 2：代表更新数据
    void sendUsrData(QString _id, QString _passwd, QString _name, int operation);
    void updateBroList(QTcpSocket *tcp);
    void sendId_Msg(QString to_id, QString from_id, QString msg);
    void sendFileContent(QString from, QString to, int len, QString data);
    void sendAll(QString to, QString all);
    void sendGroupMsg(QString from, QString to, QString msg);
    void sendTp(QString tp);
    void sendNoSay(QString noSay);
    void sendOpenSay(QString openSay);

public slots:

protected:
    void run() override;

};

#endif // THREAD_RDWR_H
